package com.itheima.demo5;

import java.io.*;

public class IODemo13 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        //序列化流
        //创建对象
        Student stu = new Student("张三", 23,"南京");

        //创建对象操作输出流/序列化流的对象
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("a.txt"));

        oos.writeObject(stu);


        oos.close();


        //反序列化流
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("a.txt"));

        Object o = ois.readObject();

        System.out.println(o);

        ois.close();
    }
}
